﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebReports
{
    public class ReportServerCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
    {
        private string _Domain;
        private string _Password;
        private string _Username;

        public ReportServerCredentials()
        {
            _Domain = "NT-TUTDL01";
            _Password = "12345qwerT";
            _Username = "ReportUser";
        }

        public ReportServerCredentials(string domain, string username, string password)
        {
            _Domain = domain;
            _Username = username;
            _Password = password;
        }

        public string Domain
        {
            get { return _Domain; }
            set { _Domain = value; }
        }

        public string Password
        {
            get { return _Password; }
            set { _Password = value; }
        }

        public string Username
        {
            get { return _Username; }
            set { _Username = value; }
        }


        #region IReportServerCredentials 成员

        public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string userName, out string password, out string authority)
        {
            authCookie = null;
            userName = null;
            password = null;
            authority = null;
            return false;
            //throw new System.NotImplementedException();
        }

        public System.Security.Principal.WindowsIdentity ImpersonationUser
        {
            get { return null; }
        }

        public System.Net.ICredentials NetworkCredentials
        {
            get { return new System.Net.NetworkCredential(Username, Password, Domain); }
        }

        #endregion
    }
}